<?php
include_once "public/SQLorder.php";
include_once "public/connect.php";
//开启session
session_start();
//接受数据
$email = $_POST('email');
$pwd = md5($_POST("pwd"));


//邮箱正则
$verifyEmail = "/^([0-9A-Za-z\\-_\\.]+)@([0-9a-z]+\\.[a-z]{2,3}(\\.[a-z]{2})?)$/i";

if(preg_match( $verifyEmail, $email )){
    $res = getone("users", $link,"email='$email'&&pwd='$pwd'");
    if($res){
        $_SESSION['name'] = $email;
        $_SESSION['uId'] = $res['id'];
        echo "<script>location.href='index.html';</script>";
    }else{
        echo "请输入正确的密码";
    }
}else{
    echo "请输入正确的邮箱地址";
}
